import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

/* Layout */
// import Layout from "@/layout";
// views/choose-company

export const constantRoutes = [
  {
    path: "/login",
    component: () => import((`@/views/login/index`)),
    hidden: true,
    meta: {
      keepAlive: true
    }
  },
  {
    path: "/",
    redirect: "/choose-system"
  },
  {
    path: "/choose-system",
    name: 'chooseSystem',
    component: () => import("@/views/choose-system/index"),
    hidden: true
  },
  {
    path: "/choose-company",
    name: 'chooseCompany',
    component: () => import("@/views/choose-company/index"),
    hidden: true
  },
  {
    path: "/404",
    component: () => import("@/views/404"),
    hidden: true
  },
  {
    path: "/redirect",
    component: () => import("@/views/redirect"),
    hidden: true
  },
  {
    path: "/app-download",
    component: () => import("@/views/app-download/index"),
    hidden: true
  }

];
// 引用模块路由
import IotMonitoringRouter from "./modules/IotMonitoringRouter";
import MonitoringAlarmRouter from "./modules/MonitoringAlarmRouter";
import InputPondManageRouter from "./modules/InputPondManageRouter";
import OperationManageRouter from "./modules/OperationManageRouter";
import BatchManageRouter from "./modules/BatchManageRouter";
import PatrolManagementRouter from "./modules/PatrolManagementRouter";
import HealthManagementRouter from "./modules/HealthManagementRouter";
import TransferSeparatePondRouter from "./modules/TransferSeparatePondRouter";
import InPondEstimationRouter from "./modules/InPondEstimationRouter";
import InspectionManageRouter from "./modules/InspectionManageRouter";
import OutputManageRouter from "./modules/OutputManageRouter";
import ClearPondManageRouter from "./modules/ClearPondManageRouter";
import InputManageRouter from "./modules/InputManageRouter";
import DiseaseBankManageRouter from "./modules/DiseaseBankManageRouter";
import StatisticalReport from "./modules/StatisticalReport"; // 统计报表
import FeedingManagementRouter from "./modules/FeedingManagementRouter";
import WarehouseManageRouter from "./modules/WarehouseManageRouter";
import BasicInfoManageRouter from "./modules/BasicInfoManageRouter";
import SystemSettingsRouter from "./modules/SystemSettingsRouter";
import qualityControlRputer from "./modules/QualityControl";
// import MaintenanceManagement from "./modules/MaintenanceManagement";
import omsMaintenanceManagement from "./modules/omsRoutermodules/MaintenanceManagement";
import omsSystemSettingsRouter from "./modules/omsRoutermodules/SystemSettingsRouter";
// import omsBasicInfoManageRouter from "./modules/omsRoutermodules/InspectionManagementRouter"
import basicsInfo from "./modules/traceabilityModules/basicsInfo";
import traceabilitySystem from "./modules/traceabilityModules/traceabilitySystem";

// import NcQueryRouter from './modules/NcQueryRouter'
export const asyncRoutes = [
  //运营管理
  omsMaintenanceManagement,
  //运营管理
  omsSystemSettingsRouter,
  // 物联监控
  IotMonitoringRouter,
  // 监测告警管理
  MonitoringAlarmRouter, // 只是搬过来而已 图标都没有
  // 批次管理
  BatchManageRouter,
  // 投塘管理
  InputPondManageRouter,
  // 作业管理
  OperationManageRouter,
  // 转分塘管理
  TransferSeparatePondRouter,
  // 投料管理
  FeedingManagementRouter,
  // 巡塘管理
  PatrolManagementRouter,
  // 检验管理
  // InspectionManageRouter,
  //质量检验
  qualityControlRputer,
  // 健康管理
  HealthManagementRouter,
  // 在塘沽产
  InPondEstimationRouter,
  // 产出管理
  OutputManageRouter,
  // 清塘管理
  ClearPondManageRouter,
  // 投入品管理
  InputManageRouter,
  // 疾病库管理
  DiseaseBankManageRouter,
  // 统计报表
  StatisticalReport,
  // 疾病知识库管理
  // DiseaseDatabaseRouter, 
  // 仓储管理
  WarehouseManageRouter,
  // 基础信息管理
  BasicInfoManageRouter,
  // 系统设置
  SystemSettingsRouter,
  //溯源管理系统
  // traceabilitySystem,
  //溯源管理系统 
  // basicsInfo,
  // 运营管理
  // MaintenanceManagement
  //NC查询接口
  // NcQueryRouter,
];

// ----------↓↓↓↓↓↓----------↓↓↓↓↓↓-------↓↓↓↓↓↓---------↓↓↓↓↓↓--------↓↓↓↓↓↓
//v2.0模块
import diseasePreventionAndControl from "./modules/disease-prevention-and-control";
import productionManagement from "./modules/production-management";
import qualityManagement from "./modules/quality-management";
import newQualityControl from "./modules/quality-control";
import productionManagementNc from "./modules/production-management-nc";
import ReportManagement from "./modules/report-management.js";


//运营
export const operateRouter = [
  //运营管理
  omsMaintenanceManagement,
  //运营管理
  omsSystemSettingsRouter,
]
//生产
export const productionMgmRouter = [
  //物联监控
  IotMonitoringRouter,
  // 生产管理
  productionManagement,
  //NC对接生产模块
  productionManagementNc,
  // 病害防治
  diseasePreventionAndControl,
  // 质量管理
  qualityManagement,
  // 质量追溯
  // newQualityControl,
  //报表
  ReportManagement,
  // 基础信息管理
  BasicInfoManageRouter,
  //NC查询接口
  // NcQueryRouter,


]

const createRouter = () =>
  new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
  });

const router = createRouter();


export function resetRouter() {
  const newRouter = createRouter();
  router.matcher = newRouter.matcher; // reset router
}

export default router;
